-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make pointer events affect focus #822
Conversation
if !root | ||
.widget_arena | ||
.states | ||
.get_id_path(target_widget_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to be in what context a possibly focusable widget could be nested inside another possibly focusable widget (that is, why this isn't just target_widget_id != focused_widget
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't disagree, but I don't want to make it a hard rule either.
masonry/src/render_root.rs
Outdated
@@ -616,7 +621,7 @@ impl RenderRoot { | |||
} | |||
|
|||
pub(crate) fn widget_from_focus_chain(&mut self, forward: bool) -> Option<WidgetId> { | |||
let focused_widget = self.global_state.focused_widget; | |||
let focused_widget = self.global_state.ghost_focus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be:
let focused_widget = self.global_state.ghost_focus; | |
let focused_widget = self.global_state.focused_widget.or(self.global_state.ghost_focus); |
That is, if there is an actual currently focused widget, we should start from that for tab-focusing and the like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, fair enough. I would let me remove a lot of code that tries to keep ghost focus and regular focus synchronized.
I ain't afraid of no ghost.
@@ -74,6 +74,7 @@ pub(crate) struct RenderRootState { | |||
pub(crate) focused_widget: Option<WidgetId>, | |||
pub(crate) focused_path: Vec<WidgetId>, | |||
pub(crate) next_focused_widget: Option<WidgetId>, | |||
pub(crate) most_recently_clicked_widget: Option<WidgetId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth having just a sprinkling of documentation/explanation here (the same could be said about most of these fields, but this one is a bit non-obvious)
Clear the focus when user clicks outside of the focused widget
Add
most_recently_clicked_widget
value, so that clicking influences which widget will be focused by future Tab events.